@extends('layout.home.login')
@section('title')
数码-注册
@stop

@section('content')
<div class="res-banner">
	<div class="res-main">
		<div class="login-banner-bg"><span></span><img src="/home/images/big.jpg" /></div>
		<div class="login-box">

				<div class="am-tabs" id="doc-my-tabs">
					<ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
						<li><a href="">手机号找回密码</a></li>
					</ul>
					<a href="/home/login" class="zcnext am-fr am-btn-default">登录</a>
					<div class="am-tabs-bd">

						<div class="am-tab-panel">
							<form action="/home/register/pass" method="post">
								{{ csrf_field() }}
								<div class="user-phone">
									<label for="phone" ><i class="am-icon-mobile-phone am-icon-md"></i></label>
									<input type="tel" name="user_phone" id="phone" placeholder="请输入手机号" required>
								</div>
								<span><p style="font-size:12px;color:red;">{{ session('error') }}</p></span>
								<div class="verification">
									<label for="code" style="margin-top:2px;height:2px;"><i class="am-icon-code-fork"></i></label>
									<input type="tel" name="phone_code" id="code" placeholder="请输入验证码" required>
									<a class="btn" href="javascript:void(0);" onClick="get_mobile_code()" id="sendMobileCode">
										<span id="dyMobileButton">获取</span></a>
								</div>
									<div class="user-pass">
									<label for="password" style="margin-top:2px;height:2px;"><i class="am-icon-lock"></i></label>
									<input type="password" name="user_pass" id="password" placeholder="设置密码" required>
									</div>											
				        		<span></span>
								<div class="am-cf">
									<input type="submit" name="" value="找回密码" class="am-btn am-btn-primary am-btn-sm am-fl">
								</div>
							</form>																				
							<hr>
						</div>
						
						<script>
							$(function() {
							    $('#doc-my-tabs').tabs();
							  })
						</script>

				</div>
			</div>

	</div>
</div>


<!-- 手机找回密码js -->						
<script language="javascript">
	function get_mobile_code(){
		// alert(1)
		$.ajaxSetup({
	        headers: {
	            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
	        }
		});

		$.post('/home/register/phone', {mobile:jQuery.trim($('#phone').val())}, function(msg) {
            alert(jQuery.trim(unescape(msg)));
			if(msg=='短信发送成功'){
				RemainTime();
			}
        });

	};
	var iTime = 59;
	var Account;
	function RemainTime(){
		document.getElementById('zphone').disabled = true;
		var iSecond,sSecond="",sTime="";
		if (iTime >= 0){
			iSecond = parseInt(iTime%60);
			iMinute = parseInt(iTime/60)
			if (iSecond >= 0){
				if(iMinute>0){
					sSecond = iMinute + "分" + iSecond + "秒";
				}else{
					sSecond = iSecond + "秒";
				}
			}
			sTime=sSecond;
			if(iTime==0){
				clearTimeout(Account);
				sTime='获取手机验证码';
				iTime = 59;
				document.getElementById('zphone').disabled = false;
			}else{
				Account = setTimeout("RemainTime()",1000);
				iTime=iTime-1;
			}
		}else{
			sTime='没有倒计时';
		}
		document.getElementById('zphone').value = sTime;
	}	
</script>
@endsection